import { defineStore } from "pinia"
import axios from 'axios';
import { nanoid } from 'nanoid/non-secure';
export const useTalkStore = defineStore("talk", {
  actions: {
    async getAPic() {
      let res = await axios.get("https://v2.xxapi.cn/api/wallpaper")
      let obj = { id: nanoid(), src: res.data.data }
      this.talkList.push(obj)
    }
  },
  //真正存储数据的地方
  state() {
    return {
      talkList: [
        { id: "001", src: "https://images.xxapi.cn/images/wallpaper/x9BARVmJnO8kyBArwgXFLwxg.jpg" }
      ]

    }
  }
})